/**
 *  todo:将接口获取到的应用信息保存到 h5 的code中
 *  0 模板id, 1 渠道号, 2 appKey, 3 背景图,
 *  4是否使用p2p cdn加速 默认不使用cdn，使用p2p p2p=1 cdn=0
 *  5 打包version, 6 appsecret, 7 cpCode
 */

const fs = require('fs')
const path = require('path')
console.log('process.argv:',process.argv)
const config = `
const config = {
  debug:true,
  admin_server:{
    prefix:'http://',
    base_url:'stage-webapp-api.cloud.ottcn.com',
    mysql_config: {
      host: '${process.argv[2]}',
      user:  '${process.argv[3]}',
      password: '${process.argv[4]}'
    },
  },
  app_server:{
    prefix:'http://',
    base_url:'stage-webapp.cloud.ottcn.com',
    template_base_url: '/assets/template',
    background_base_url: '/assets/background',
    image_base_url: '/assets/image'
  }
}
module.exports = config
`
fs.writeFileSync(path.resolve(__dirname,'./config.js'),config)
